package com.azdebugit.collection.utils.test;

import org.apache.commons.collections4.map.SingletonMap;

public class SingletonMapApp {

    public static void main(String[] args) {
        SingletonMap<String, String> singletonMap = new SingletonMap<>();

        System.out.println(singletonMap);
        System.out.println(singletonMap.size());
        System.out.println(singletonMap.maxSize());

        // 哪怕一个都没有 也不能设置值
//        singletonMap.put("name","Answer"); // Cannot put new key/value pair - Map is fixed size singleton

        // 虽然不能再放key 但可以改值
        singletonMap.setValue("Answer");
        System.out.println(singletonMap);

        // 一般建议在构造的时候，就给key和value赋值  如下：
        singletonMap = new SingletonMap<>("name","Jaemon");
        System.out.println(singletonMap);
    }

}
